package com.netwit.common.service;

import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface CommonService {

    /**
     * 数据库单表查询
     * @param map 包含：表名tableName(必须)，字段名列表fields，查询条件where，分页信息page&size-limit，排序orderBy
     * @return 返回一个集合，包含数据(data,JSON格式的数组)，有分页时还有分页信息pageInfo和分页的导航链接
     */
    Map<String, Object> list(Map<String, Object> map);

    Integer insert(Map<String, Object> map);

    Map<String, Object> getOne(Map<String, Object> map);

    Integer update(Map<String, Object> map);

    Integer delete(Map<String, Object> map);

    List<Map<String, Object>> query(Map<String, Object> map);

    Map<String, Object> queryOne(Map<String, Object> map);

    Integer insertEntity(@Param("entity") Object entity, @Param("tableName") String tableName);

    Integer updateEntity(@Param("entity") Object entity, @Param("tableName") String tableName);

    Integer batchInsertUpdateEntities(@Param("list") List<Object> list, @Param("tableName") String tableName);

    //Integer batchInsertUpdateMaps(@Param("list") List<Object> list, @Param("tableName") String tableName);
    Integer batchInsertUpdateMaps(Map<String, Object> map);
}
